/*
使用指针访问数组中的元素 
 */
#include <stdio.h>

int main(){
	int arr[5] = {11,22,33,44,55};
	int i = 0;
	int* p = arr;
	for(i = 0;i<5;i++){
		//printf("arr[%d] = %d\n",i,arr[i]);
		//arr[0] => *arr 
		//arr[1] => *(arr + 1)
		//arr[i] => *(arr + i)
		printf("&arr[%d] = %p \n",i,&arr[i]);
		/*printf("arr + %d = %p \n",i,arr+i);
		printf("arr[%d] = %d\n",i,*(arr+i));
		printf("arr[%d] = %d \n",i,*(i+arr));
		//仅供娱乐
		printf("arr[%d] = %d \n",i,i[arr]);
		printf("arr[%d] = %d \n",i,p[i]);
		printf("arr[%d] = %d \n",i,i[p]);
		printf("arr[%d] = %d \n",i,*(p+i));
		printf("arr[%d] = %d \n",i,*(i+p));*/
	}
	//printf("arr[%d] = %d\n",i,*p++);
	//arr的值不可以改变
	//printf("arr[%d] = %d\n",i,*arr++);
	p++;
	printf("-----------------------------------------\n");
	printf("arr=%p,p= %p\n",arr,p);
	return 0;
}
